<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8">
    <title>添加促销活动</title>

    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <!-- <script>
      (function () {
        if (window !== window.top) {
          window.top.location.href = 'http://www.818tu.com';
        }
      })();
    </script> -->

    <!-- bootstrap & fontawesome -->








    <!-- page specific plugin styles -->
    <script src="__PUBLIC__/admin/js/jquery.min.js"></script>
    <script src="__PUBLIC__/admin/js/lodash.min.js"></script>
    <script src="__PUBLIC__/admin/js/moment.min.js"></script>
    <script src="__PUBLIC__/admin/js/zh-cn.js"></script>
    <script src="__PUBLIC__/admin/js/numeral.min.js"></script>
    <script src="__PUBLIC__/admin/js/toastr.min.js"></script>
    <script src="__PUBLIC__/admin/js/cookies.js"></script>
    <script src="__PUBLIC__/admin/js/knockout-min.js"></script>
    <script src="__PUBLIC__/admin/js/knockout.mapping.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap-datetimepicker.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.unobtrusive.min.js"></script>
    <script src="__PUBLIC__/admin/js/clipboard.min.js"></script>
    <script src="__PUBLIC__/admin/js/select2.min.js"></script>
    <script src="__PUBLIC__/admin/js/admin.js"></script>
    <script>
      moment.locale('zh-cn');
      toastr.options.positionClass = 'toast-bottom-right';
    </script>

    <!-- text fonts -->


    <!-- ace styles -->


    <!--[if lte IE 9]>
        <link rel="stylesheet" href="http://novel.818tu.com/static/assets/css/ace-part2.min.css" />
    <![endif]-->




    <!--[if lte IE 9]>
        <link rel="stylesheet" href="http://novel.818tu.com/static/css/ace-ie.min.css" />
    <![endif]-->



    <!-- inline styles related to this page -->

    <!-- ace settings handler -->
    <script src="__PUBLIC__/admin/js/ace-extra.min.js"></script>

    <!-- <script>
      var __BASEURL = "http://novel.818tu.com/";
    </script> -->

<link media="all" href="__PUBLIC__/admin/css/index15.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/glyphicons-halflings-regular.css">
</head>
<body class="no-skin">

    <!-- #section:basics/navbar.layout -->
        <include file="./Public/gong/title.html" />

    <div class="main-container" id="main-container">
      <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
      </script>

      <div id="sidebar" class="sidebar responsive">
          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
          </script>

                     <include file="./Public/gong/list.html" />
          <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
            <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
          </div>

          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
          </script>
      </div>

      <!-- /section:basics/sidebar -->
      <div class="main-content">

                    <!-- <div id="invalid-mp-settings-hint" style="border-top: 0px none; border-left: 0px none; border-right: 0px none; margin: 0px;" class="alert alert-warning">
    <i class="fa fa-warning"></i> 您的公众号配置不完整，推广前请务必配置好公众号信息。<a href="http://novel.818tu.com/backend/settings/mp">立即配置</a>
</div> -->

<!-- <script>
    $.get('/backend/settings/api_check_mp_settings?t' + new Date().getTime(), function (result) {
        if (!result.valid) {
            $('#invalid-mp-settings-hint').slideDown();
        }
    });
</script> -->
        <div class="breadcrumbs" id="breadcrumbs">
          <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
          </script>

          <ul class="breadcrumb">
            <li>
              <i class="ace-icon fa fa-home home-icon"></i>
              <a href="__APP__/Admin/Index/index.html">Home</a>
            </li>
            <li class="active">添加促销活动</li>
          </ul><!-- /.breadcrumb -->

          <!-- /section:basics/content.searchbox -->
        </div>

        <!-- /section:basics/content.breadcrumbs -->
        <div class="page-content">
          <div class="page-content-area">
            <div class="row">
              <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->

                <!--/span-->
                <!-- left menu ends -->



<form id="main-form" class="form-horizontal" novalidate="novalidate" action="__URL__/do_add_activity_list" method="POST">
    <h4>活动信息</h4>
    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right">活动标题</label>
        <div class="col-sm-9">
            <input name="data[hname]" class="col-xs-10 col-sm-2"  data-val="true"  value="{$promotion['hname']}" type="text" >
            <p class="help-block help-block-error" data-valmsg-for="username" data-valmsg-replace="true"></p>
        </div>
    </div>
<!--    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right">结束时间</label>
        <div class="col-sm-9">
            <input name="time2" class="col-xs-10 col-sm-2"  data-val="true"  value="{$promotion['time2']}" type="text" onClick="laydate()">
            <p class="help-block help-block-error" data-valmsg-for="username" data-valmsg-replace="true"></p>
        </div>
    </div>-->

    <div class="form-group" data-bind="visible: !is_edit()" style="">
        <label class="col-sm-3 control-label no-padding-right">30元赠送额度</label>
        <div class="col-sm-9">
            <input name="data[p30]" class="col-xs-10 col-sm-2" data-val="true" data-val-required="请输入额度" data-bind="value: password" value="{$promotion['p30']}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')"><div style="margin-top:5px;">&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;书币</div>
            <p class="help-block help-block-error" data-valmsg-for="password" data-valmsg-replace="true"></p>
        </div>
    </div>
    <div class="form-group" data-bind="visible: !is_edit()" style="">
        <label class="col-sm-3 control-label no-padding-right">50元赠送额度</label>
        <div class="col-sm-9">
            <input name="data[p50]" class="col-xs-10 col-sm-2" data-val="true" data-val-required="请输入额度" data-bind="value: password" value="{$promotion['p50']}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')"><div style="margin-top:5px;">&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;书币</div>
            <p class="help-block help-block-error" data-valmsg-for="password" data-valmsg-replace="true"></p>
        </div>
    </div>
    <div class="form-group" data-bind="visible: !is_edit()" style="">
        <label class="col-sm-3 control-label no-padding-right">100元赠送额度</label>
        <div class="col-sm-9">
            <input name="data[p100]" class="col-xs-10 col-sm-2" data-val="true" data-val-required="请输入额度" data-bind="value: password" value="{$promotion['p100']}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')"><div style="margin-top:5px;">&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;书币</div>
            <p class="help-block help-block-error" data-valmsg-for="password" data-valmsg-replace="true"></p>
        </div>
    </div>
    <div class="form-group" data-bind="visible: !is_edit()" style="">
        <label class="col-sm-3 control-label no-padding-right">200元赠送额度</label>
        <div class="col-sm-9">
            <input name="data[p200]" class="col-xs-10 col-sm-2" data-val="true" data-val-required="请输入额度" data-bind="value: password" value="{$promotion['p200']}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')"><div style="margin-top:5px;">&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;书币</div>
            <p class="help-block help-block-error" data-valmsg-for="password" data-valmsg-replace="true"></p>
        </div>
    </div>
    <div class="form-group" data-bind="visible: !is_edit()" style="">
        <label class="col-sm-3 control-label no-padding-right">季度VIP购买价格</label>
        <div class="col-sm-9">
            <input name="data[pvip]" class="col-xs-10 col-sm-2" data-val="true" data-val-required="请输入购买价格" data-bind="value: password" value="{$promotion['pvip']}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')"><div style="margin-top:5px;">&nbsp;&nbsp;&nbsp;&nbsp;/￥</div>
            <p class="help-block help-block-error" data-valmsg-for="password" data-valmsg-replace="true"></p>
        </div>
    </div>
<div class="form-group" data-bind="visible: !is_edit()" style="">
        <label class="col-sm-3 control-label no-padding-right">年VIP购买价格</label>
        <div class="col-sm-9">
            <input name="data[pyear_vip]" class="col-xs-10 col-sm-2" data-val="true" data-val-required="请输入购买价格" data-bind="value: password" value="{$promotion['pyear_vip']}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')"><div style="margin-top:5px;">&nbsp;&nbsp;&nbsp;&nbsp;/￥</div>
            <p class="help-block help-block-error" data-valmsg-for="password" data-valmsg-replace="true"></p>
        </div>
    </div>
    <div class="clearfix form-actions">
        <div class="col-md-offset-3 col-md-9">
            <input type="hidden" name="data[id]" value="{$promotion['id']}">
            <button type="submit" class="btn btn-info" data-bind="click: submit, disable: submitting">提交</button>
        </div>
    </div>
</form>

<!-- <script>
    var userId = null;
    var isEdit = parseInt(userId) > 0;

    var viewModel = {
        id: ko.observable(userId),
        is_edit: ko.observable(isEdit),
        submitting: ko.observable(false),
        username: ko.observable(),
        password: ko.observable(),
        nickname: ko.observable(),
        email: ko.observable(),
        mobile: ko.observable(),
        commission_rate: ko.observable(),
        enable_vip_products: ko.observable(false),
        enable_template_message: ko.observable(false),
        affiliate_level: ko.observable(),
        remark: ko.observable(),

        inviter_uid: ko.observable(),
        inviter_reward_rate: ko.observable(),

        payment_account_type: ko.observable('bank'),

        card_holder_name: ko.observable(),
        card_number: ko.observable(),
        card_bank_branch: ko.observable(),
        is_company: ko.observable(false),

        alipay_account_number: ko.observable(),
        alipay_account_name: ko.observable(),

        weixin_account: ko.observable(),
        weixin_nickname: ko.observable(),

        auto_withdraw: ko.observable(0),

        is_internal_channel: ko.observable(0)
    };

    viewModel.submit = function () {
        if (viewModel.submitting()) {
            return false;
        }

        if (!$('#main-form').valid()) {
            return false;
        }

        viewModel.submitting(true);

        $.ajax({
            url: '/backend/users/api_save',
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify(ko.mapping.toJS(viewModel))
        })
            .then(function (data) {
                location.href = '/backend/users/affiliates';
            })
            .fail(handleAjaxError)
            .always(function () {
                viewModel.submitting(false);
            });
    };

    $(function () {
        if (userId) {
            $.get('/backend/users/api_get/' + userId, function (data) {
                ko.mapping.fromJS(data, {}, viewModel);
                ko.applyBindings(viewModel, document.getElementById('main-form'));
            });
        } else {
            viewModel.password('JhFWfE9q');
            ko.applyBindings(viewModel, document.getElementById('main-form'));
        }
    });
</script> -->

                                <!-- PAGE CONTENT ENDS -->
                            </div><!-- /.col -->
                        </div><!-- /.row -->
                    </div><!-- /.page-content-area -->
                </div><!-- /.page-content -->
            </div><!-- /.main-content -->

        </div><!-- /.main-container -->

        <!-- basic scripts -->

      <!--   <script type="text/javascript">
            if('ontouchstart' in document.documentElement) document.write("<script src='http://novel.818tu.com/static/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
        </script> -->
        <script src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.webui-popover.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.ui.widget.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.fileupload.min.js"></script>

        <!-- page specific plugin scripts -->

        <!-- ace scripts -->
        <script src="__PUBLIC__/admin/js/ace-elements.min.js"></script>
        <script src="__PUBLIC__/admin/js/ace.min.js"></script>

        <!-- inline scripts related to this page -->

        <!-- the following scripts are used in demo only for onpage help and you don't need them -->


        <!-- <script type="text/javascript"> ace.vars['base'] = 'http://novel.818tu.com/static'; </script> -->
        <script src="__PUBLIC__/admin/js/elements.onpage-help.js"></script>
        <script src="__PUBLIC__/admin/js/ace.onpage-help.js"></script>
        <script src="__PUBLIC__/admin/laydate/laydate.js"></script>
        <script>
        ;!function(){
        laydate({
           elem: '#demo'
        })
        }();
        </script>


</body>
</html>
